package com.yyj.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yyj.dao.ReserveDao;
import com.yyj.entity.Params;
import com.yyj.entity.Reserve;
import com.yyj.entity.TimeSelection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Array;
import java.util.List;
import java.util.Map;

@Service
public class ReserveService {
    @Autowired
    private ReserveDao reserveDao;
    public void establish(Reserve reserve) {
        reserveDao.establish(reserve);
    }

    public  List<TimeSelection> getNum(String doctorName) {
        List<TimeSelection> list = reserveDao.getNum(doctorName);
        return list;
    }

    //医生获取其预约信息
    public PageInfo<Reserve> getReserve(Params params) {
        PageHelper.startPage(params.getPageNum(), params.getPageSize());
        List<Reserve> reserves = reserveDao.getReserve(params);
        return PageInfo.of(reserves);
    }

    public List<Reserve> getApplication(String userName) {
        List<Reserve> list = reserveDao.getApplication(userName);
        return list;
    }

    public void setPrice(Reserve reserve) {
        reserveDao.setPrice(reserve);
    }
    public void delete(Integer id) {
        reserveDao.delete(id);
    }
}
